package PTA_JAVA.JavaB.Javademo11;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int seed = sc.nextInt();
        int begin = sc.nextInt();
        int end = sc.nextInt();

        ArrayList<Integer> arr=new ArrayList<Integer>();
        Random random=new Random(seed);
        int sum=0;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n-10; i++) {
            int r=random.nextInt(end)+begin;
        }
        for (int i = n-10; i < n; i++) {
            int r=random.nextInt(end)+begin;
            System.out.print(r+" ");
            sum=sum+r;
            arr.add(r);
            sb.append(r);
        }
        System.out.println();
        Collections.sort(arr);
        System.out.println(sum);
        System.out.println(sb.toString());
        System.out.println(arr.toString());
    }
}
